//@author A0097978X
package flexiCommands;

import java.util.Calendar;

import storage.Time;
import storage.Date;

public class Clock {

	private static Calendar cal = Calendar.getInstance();

	public static Time getCurrentTime() throws Exception {
		int hour, minute, second;
		hour = cal.get(Calendar.HOUR_OF_DAY);
		minute = cal.get(Calendar.MINUTE);
		second = cal.get(Calendar.SECOND);
		
		return new Time(hour, minute, second);
	}
	
	public static Date getCurrentDate() throws Exception {
		int day, month, year;
		day = cal.get(Calendar.DAY_OF_MONTH);
	    month = cal.get(Calendar.MONTH) + 1;
	    year = cal.get(Calendar.YEAR);
	    
	    return new Date(year, month, day);
	}
}
